Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 2 - Geometric Shapes


Using Geometric Shapes

This section shows you how to create, edit, and draw geometric shapes. In particular, this section shows you how to

All of the sample functions in this section create geometric shapes with default style, ink, and transform information. All shapes are black; framed shapes have one-pixel-wide contours; and the shapes are not rotated, skewed, and so on. For examples of the many stylistic variations you can apply to geometric shapes, see Chapter 3 of this book, "Geometric Styles." For information about inks and transforms, see Inside Macintosh: QuickDraw GX Objects.

Many of the sample functions in this section create geometric shapes and, to do so, they specify geometric points for the shapes' geometries. Since a geometric point contains two fixed-point values (of type Fixed), the sample functions in this section must convert integer constants to fixed-point constants when specifying a geometric point. QuickDraw GX provides the GXIntToFixed macro, which performs this conversion by shifting the integer value 16 bits to the left:

#define GXIntToFixed(a) ((Fixed)(a) << 16)
QuickDraw GX also provides the ff macro as a convenient alias:

#define ff(a) GXIntToFixed(a)
A few of the sample functions in this section specify fractional values for geometric point coordinates. To convert a floating-point value (of type float) to a fixed-point value (type Fixed), QuickDraw GX provides the GXFloatToFixed macro:

#define GXFloatToFixed(a) ((Fixed)((float)(a) * fixed1))
and the synonymous fl macro:

#define fl(a) GXFloatToFixed(a)
IMPORTANT
The GXIntToFixed macro has substantially faster performance than the GXFloatToFixed macro. Whenever possible, you should choose the GXIntToFixed macro over the GXFloatToFixed macro.

Subtopics
Creating and Drawing Empty Shapes and Full Shapes
Creating and Drawing Points
Creating and Drawing Lines
Creating and Drawing Curves
Creating and Drawing Rectangles
Creating and Drawing Polygons
Creating and Drawing Paths
Converting Between Geometric Shape Types
Replacing Geometric Points
Editing Polygon Parts
Editing Paths Parts
Editing Shape Parts

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help